suppressPackageStartupMessages(library(tidyverse))
suppressPackageStartupMessages(library(tinytable))
suppressPackageStartupMessages(library(ape))
suppressPackageStartupMessages(library(distillR))
suppressPackageStartupMessages(library(ggtree))
suppressPackageStartupMessages(library(ggnewscale))
suppressPackageStartupMessages(library(ggtreeExtra))
suppressPackageStartupMessages(library(gridExtra))
suppressPackageStartupMessages(library(phytools))
suppressPackageStartupMessages(library(Rtsne))
Working data objects are wrapped in the Rdata file created in the previous step.
load("data/data.Rdata")
#Get phylum colors from the EHI standard
phylum_colors <- read_tsv("https://raw.githubusercontent.com/earthhologenome/EHI_taxonomy_colour/main/ehi_phylum_colors.tsv") %>%
right_join(genome_metadata, by=join_by(phylum == phylum)) %>%
arrange(match(genome, genome_tree$tip.label)) %>%
select(phylum, colors) %>%
unique() %>%
arrange(phylum) %>%
select(colors) %>%
pull()
# Generate the phylum color heatmap
phylum_heatmap <- read_tsv("https://raw.githubusercontent.com/earthhologenome/EHI_taxonomy_colour/main/ehi_phylum_colors.tsv") %>%
right_join(genome_metadata, by=join_by(phylum == phylum)) %>%
arrange(match(genome, genome_tree$tip.label)) %>%
select(genome,phylum) %>%
mutate(phylum = factor(phylum, levels = unique(phylum))) %>%
column_to_rownames(var = "genome")
# Generate basal tree
circular_tree <- force.ultrametric(genome_tree, method="extend") %>% # extend to ultrametric for the sake of visualisation
ggtree(., layout="fan", open.angle=10, size=0.5)
## ***************************************************************
## * Note: *
## * force.ultrametric does not include a formal method to *
## * ultrametricize a tree & should only be used to coerce *
## * a phylogeny that fails is.ultrametric due to rounding -- *
## * not as a substitute for formal rate-smoothing methods. *
## ***************************************************************
# Add phylum ring
circular_tree <- gheatmap(circular_tree, phylum_heatmap, offset=0.85, width=0.1, colnames=FALSE) +
scale_fill_manual(values=phylum_colors) +
geom_tiplab2(size=1, hjust=-0.1) +
theme(legend.position = "none", plot.margin = margin(0, 0, 0, 0), panel.margin = margin(0, 0, 0, 0))
# Flush color scale to enable a new color scheme in the next ring
circular_tree <- circular_tree + new_scale_fill()
# Add completeness ring
circular_tree <- circular_tree +
new_scale_fill() +
scale_fill_gradient(low = "#d1f4ba", high = "#f4baba") +
geom_fruit(
data=genome_metadata,
geom=geom_bar,
mapping = aes(x=completeness, y=genome, fill=contamination),
offset = 0.55,
orientation="y",
stat="identity")
# Add genome-size ring
circular_tree <- circular_tree +
new_scale_fill() +
scale_fill_manual(values = "#cccccc") +
geom_fruit(
data=genome_metadata,
geom=geom_bar,
mapping = aes(x=length, y=genome),
offset = 0.05,
orientation="y",
stat="identity")
# Add text
circular_tree <- circular_tree +
annotate('text', x=3.0, y=0, label=' Phylum', family='arial', size=3.5) +
annotate('text', x=3.3, y=0, label=' Genome quality', family='arial', size=3.5) +
annotate('text', x=3.7, y=0, label=' Genome size', family='arial', size=3.5)
#Plot circular tree
circular_tree %>% open_tree(30) %>% rotate_tree(90)
The number of reconstructed bacterial genomes is lower than other
broiler chicken studies we have run before. However, it must be noted
that these animals were kept in isolators, with limited contact with the
outer environments, and the observed lower diversity is therefore
expected.
# Create table
genome_metadata_table <- genome_metadata %>%
arrange(match(genome, genome_tree$tip.label)) %>%
mutate(length=length/1000000 %>% round(2)) %>%
select(genome,phylum,order,species,completeness,contamination,length)
# Print table
genome_metadata_table %>% tt() |>
style_tt(i = 0, background = "#f4f4f4") |>
style_tt(j = c(2:7), color = "#555555") |>
style_tt(j = 1, color = "#000000") |>
style_tt(i = which(genome_metadata_table$completeness >= 98), j=5, line = "l", line_color = "#dcf7be", color = "#779c4f", line_width = 0.5) |>
style_tt(i = which(genome_metadata_table$completeness >= 90 & genome_metadata_table$completeness < 98), j=5, line = "l", line_color = "#e3dcaa", color = "#78713e", line_width = 0.5) |>
style_tt(i = which(genome_metadata_table$completeness >= 70 & genome_metadata_table$completeness < 90), j=5, line = "l", line_color = "#e3caaa", color = "#91734d", line_width = 0.5) |>
style_tt(i = which(genome_metadata_table$completeness < 70), j=5, line = "l", line_color = "#e3b3a8", color = "#804a3d", line_width = 0.5) |>
style_tt(i = which(genome_metadata_table$contamination <= 1), j=6, line = "l", line_color = "#dcf7be", color = "#779c4f", line_width = 0.5) |>
style_tt(i = which(genome_metadata_table$contamination <= 5 & genome_metadata_table$contamination > 1), j=6, line = "l", line_color = "#e3dcaa", color = "#78713e", line_width = 0.5) |>
style_tt(i = which(genome_metadata_table$contamination > 5), j=6, line = "l", line_color = "#e3b3a8", color = "#804a3d", line_width = 0.5)
| genome | phylum | order | species | completeness | contamination | length |
|---|---|---|---|---|---|---|
| TG3_21:bin_000008 | p__Verrucomicrobiota | o__Verrucomicrobiales | s__Akkermansia sp905200945 | 99.99 | 1.02 | 2.743336 |
| D300459:bin_000001 | p__Bacteroidota | o__Bacteroidales | s__Alistipes excrementavium | 99.83 | 0.14 | 2.816448 |
| D300451:bin_000001 | p__Pseudomonadota | o__Enterobacterales | s__Escherichia coli | 100.00 | 2.20 | 4.965842 |
| TG1:bin_000049 | p__Pseudomonadota | o__Enterobacterales | s__Klebsiella pneumoniae | 92.78 | 1.92 | 4.979029 |
| TG5_14:bin_000020 | p__Pseudomonadota | o__Enterobacterales | s__Proteus mirabilis | 99.86 | 2.76 | 3.630330 |
| TG2:bin_000029 | p__Actinomycetota | o__Coriobacteriales | s__Rubneribacter badeniensis | 79.66 | 2.43 | 2.934164 |
| TG1:bin_000059 | p__Bacillota_A | o__RUG12999 | s__ | 53.96 | 1.53 | 2.808738 |
| D300508:bin_000006 | p__Bacillota_A | o__Oscillospirales | s__Agathobaculum intestinigallinarum | 90.75 | 1.90 | 2.519195 |
| D300493:bin_000014 | p__Bacillota_A | o__Oscillospirales | s__Agathobaculum merdipullorum | 71.22 | 2.28 | 2.044740 |
| TG2_35:bin_000003 | p__Bacillota_A | o__Oscillospirales | s__Agathobaculum stercoravium | 96.05 | 1.17 | 2.998445 |
| D300484:bin_000011 | p__Bacillota_A | o__Oscillospirales | s__Agathobaculum sp900557315 | 76.63 | 5.31 | 2.531608 |
| D300419:bin_000008 | p__Bacillota_A | o__Oscillospirales | s__Pseudobutyricicoccus lothianensis | 84.03 | 2.10 | 2.332485 |
| D300476:bin_000013 | p__Bacillota_A | o__Oscillospirales | s__Flavonifractor avicola | 72.61 | 2.99 | 2.129253 |
| D300444:bin_000011 | p__Bacillota_A | o__Oscillospirales | s__Flavonifractor plautii | 79.34 | 2.10 | 3.074978 |
| D300431:bin_000017 | p__Bacillota_A | o__Oscillospirales | s__Flavonifractor avistercoris | 68.34 | 3.07 | 2.077366 |
| TG5_14:bin_000027 | p__Bacillota_A | o__Oscillospirales | s__Intestinimonas timonensis | 81.62 | 8.27 | 3.192855 |
| D300455:bin_000019 | p__Bacillota_A | o__Oscillospirales | s__Intestinimonas stercoravium | 51.71 | 3.73 | 1.841630 |
| D300449:bin_000011 | p__Bacillota_A | o__Oscillospirales | s__Lawsonibacter sp900545895 | 77.84 | 0.85 | 2.293731 |
| D300423:bin_000014 | p__Bacillota_A | o__Oscillospirales | s__Dysosmobacter pullicola | 80.56 | 1.76 | 2.101650 |
| D300464:bin_000017 | p__Bacillota_A | o__Oscillospirales | s__Pelethomonas intestinigallinarum | 84.17 | 1.63 | 2.518730 |
| D300497:bin_000007 | p__Bacillota_A | o__Oscillospirales | s__Scatomorpha sp900759385 | 77.01 | 7.74 | 2.749011 |
| D300437:bin_000010 | p__Bacillota_A | o__Oscillospirales | s__Avoscillospira stercoripullorum | 76.07 | 4.43 | 2.003490 |
| D300450:bin_000002 | p__Bacillota_A | o__Oscillospirales | s__Faecousia gallistercoris | 90.58 | 1.82 | 2.474074 |
| D300492:bin_000002 | p__Bacillota_A | o__Oscillospirales | s__Acutalibacter ornithocaccae | 91.40 | 1.22 | 2.401962 |
| D300442:bin_000011 | p__Bacillota_A | o__Oscillospirales | s__Acutalibacter stercoravium | 82.40 | 1.99 | 2.259775 |
| D300501:bin_000005 | p__Bacillota_A | o__Oscillospirales | s__UBA1417 sp900552925 | 95.77 | 4.13 | 2.132003 |
| D300463:bin_000012 | p__Bacillota_A | o__Oscillospirales | s__Heritagella sp905215105 | 89.61 | 5.79 | 2.786124 |
| TG2_21:bin_000030 | p__Bacillota_A | o__Oscillospirales | s__Gallacutalibacter pullicola | 78.81 | 1.60 | 2.737401 |
| D300477:bin_000001 | p__Bacillota_A | o__Oscillospirales | s__Anaeromassilibacillus stercoravium | 99.96 | 0.93 | 2.687405 |
| TG4_07:bin_000019 | p__Bacillota_A | o__Oscillospirales | s__Caccousia avistercoris | 89.82 | 2.24 | 2.713577 |
| TG5_35:bin_000028 | p__Bacillota_A | o__Oscillospirales | s__Scatavimonas merdipullorum | 69.68 | 3.56 | 1.880856 |
| TG2:bin_000046 | p__Bacillota_A | o__Oscillospirales | s__ | 79.75 | 2.45 | 2.307506 |
| TG3:bin_000069 | p__Bacillota_A | o__Oscillospirales | s__CAJFUH01 sp904420155 | 86.26 | 3.68 | 2.399629 |
| D300514:bin_000005 | p__Bacillota_A | o__Oscillospirales | s__Onthovicinus excrementipullorum | 94.36 | 1.04 | 2.490008 |
| D300503:bin_000003 | p__Bacillota_A | o__Oscillospirales | s__Fimenecus stercoravium | 91.56 | 2.55 | 2.097184 |
| TG4:bin_000031 | p__Bacillota_A | o__Oscillospirales | s__Timburyella stercoris | 76.93 | 3.34 | 2.074568 |
| D300418:bin_000013 | p__Bacillota_A | o__Oscillospirales | s__Fimivicinus intestinavium | 81.41 | 1.94 | 2.332804 |
| D300490:bin_000001 | p__Bacillota_A | o__Oscillospirales | s__Scybalenecus merdavium | 99.81 | 3.12 | 2.122614 |
| D300449:bin_000002 | p__Bacillota_A | o__Oscillospirales | s__Fournierella sp002161595 | 96.95 | 4.91 | 2.975183 |
| TG3_21:bin_000001 | p__Bacillota_A | o__Oscillospirales | s__Eubacterium_R faecavium | 98.60 | 0.86 | 2.167166 |
| TG1_21:bin_000001 | p__Bacillota_A | o__Oscillospirales | s__ | 99.43 | 1.32 | 2.072942 |
| D300501:bin_000003 | p__Bacillota_A | o__Oscillospirales | s__Ruthenibacterium lactatiformans | 96.02 | 3.57 | 3.509783 |
| D300495:bin_000001 | p__Bacillota_A | o__Oscillospirales | s__Faeciplasma gallinarum | 99.95 | 1.73 | 1.864156 |
| TG3_21:bin_000030 | p__Bacillota_A | o__Oscillospirales | s__Faecivivens stercoravium | 82.13 | 1.97 | 2.422258 |
| D300519:bin_000004 | p__Bacillota_A | o__Oscillospirales | s__Merdivicinus excrementipullorum | 95.48 | 2.71 | 2.715923 |
| TG3_35:bin_000025 | p__Bacillota_A | o__Oscillospirales | s__Egerieicola faecale | 83.82 | 5.27 | 1.925359 |
| D300491:bin_000007 | p__Bacillota_A | o__Oscillospirales | s__Gemmiger stercoravium | 81.37 | 6.71 | 2.255578 |
| D300521:bin_000006 | p__Bacillota_A | o__Oscillospirales | s__Faecalibacterium faecigallinarum | 84.63 | 1.95 | 2.086084 |
| TG3_35:bin_000014 | p__Bacillota_A | o__Oscillospirales | s__Gemmiger avicola | 93.90 | 5.62 | 2.927183 |
| TG1:bin_000066 | p__Bacillota_A | o__Oscillospirales | s__Pseudoruminococcus_B merdavium | 49.51 | 0.78 | 1.586485 |
| D300477:bin_000007 | p__Bacillota_A | o__Oscillospirales | s__Anaerotruncus colihominis | 88.34 | 1.03 | 2.654163 |
| D300479:bin_000012 | p__Bacillota_A | o__Oscillospirales | s__Negativibacillus faecipullorum | 82.38 | 4.67 | 2.304801 |
| TG3_21:bin_000040 | p__Bacillota_A | o__Oscillospirales | s__Pararuminococcus gallinarum | 85.56 | 3.42 | 2.142669 |
| TG2_35:bin_000002 | p__Bacillota_A | o__UBA1381 | s__UBA4716 sp905215805 | 97.06 | 1.82 | 3.253873 |
| TG2_21:bin_000001 | p__Bacillota_A | o__UBA1381 | s__Ornithomonoglobus sp904420525 | 99.05 | 0.06 | 3.559586 |
| TG5_21:bin_000007 | p__Bacillota_A | o__UBA1381 | s__Ornithomonoglobus merdipullorum | 95.82 | 0.54 | 3.709129 |
| TG3:bin_000005 | p__Bacillota_A | o__Monoglobales | s__Roslinia sp019419865 | 91.66 | 1.13 | 2.947810 |
| D300425:bin_000002 | p__Bacillota_A | o__TANB77 | s__CAG-269 sp904419495 | 98.93 | 0.29 | 1.930826 |
| TG4_28:bin_000008 | p__Bacillota_A | o__TANB77 | s__CAG-269 sp904419095 | 96.73 | 4.67 | 2.073788 |
| D300495:bin_000005 | p__Bacillota_A | o__TANB77 | s__ | 98.04 | 1.84 | 1.810883 |
| D300458:bin_000008 | p__Bacillota_A | o__TANB77 | s__CAG-245 sp944388645 | 99.94 | 4.64 | 1.632942 |
| TG3_28:bin_000052 | p__Bacillota_A | o__TANB77 | s__ | 63.99 | 3.90 | 1.473219 |
| D300495:bin_000010 | p__Bacillota_A | o__TANB77 | s__ | 87.22 | 2.96 | 1.733997 |
| D300514:bin_000003 | p__Bacillota_A | o__TANB77 | s__ | 96.87 | 1.71 | 1.619643 |
| D300478:bin_000014 | p__Bacillota_A | o__TANB77 | s__ | 78.75 | 1.23 | 1.404768 |
| TG1_28:bin_000007 | p__Bacillota_A | o__TANB77 | s__CAG-273 sp944392105 | 99.07 | 0.54 | 1.689769 |
| TG1:bin_000045 | p__Bacillota_A | o__TANB77 | s__CAG-273 sp017886645 | 70.39 | 6.85 | 1.432099 |
| TG4:bin_000053 | p__Bacillota_A | o__TANB77 | s__CAG-273 sp944390395 | 64.63 | 4.03 | 1.328816 |
| D300442:bin_000001 | p__Bacillota_A | o__Lachnospirales | s__Tyzzerella sp944383305 | 95.41 | 0.23 | 2.386391 |
| TG5:bin_000044 | p__Bacillota_A | o__Lachnospirales | s__Gallispira edinburgensis | 66.79 | 1.76 | 1.901424 |
| TG3:bin_000065 | p__Bacillota_A | o__Lachnospirales | s__ | 63.13 | 0.89 | 2.051998 |
| D300432:bin_000001 | p__Bacillota_A | o__Lachnospirales | s__Fimicola sp944379995 | 95.93 | 0.94 | 2.795297 |
| D300446:bin_000001 | p__Bacillota_A | o__Lachnospirales | s__Anaerotignum merdipullorum | 90.77 | 1.41 | 2.639574 |
| TG5_28:bin_000015 | p__Bacillota_A | o__Lachnospirales | s__Anaerotignum lactatifermentans | 88.62 | 3.59 | 2.452201 |
| TG3:bin_000034 | p__Bacillota_A | o__Lachnospirales | s__Coprocola pullicola | 91.33 | 1.26 | 3.041869 |
| TG1:bin_000032 | p__Bacillota_A | o__Lachnospirales | s__Neoanaerotignum_A tabaqchaliae | 86.87 | 2.23 | 2.361298 |
| TG4:bin_000057 | p__Bacillota_A | o__Lachnospirales | s__Metalachnospira gallinarum | 64.87 | 1.16 | 1.597538 |
| D300514:bin_000001 | p__Bacillota_A | o__Lachnospirales | s__Eisenbergiella merdigallinarum | 98.89 | 4.14 | 3.567105 |
| D300512:bin_000016 | p__Bacillota_A | o__Lachnospirales | s__Scatomonas merdigallinarum | 72.54 | 2.85 | 2.125663 |
| TG4_07:bin_000020 | p__Bacillota_A | o__Lachnospirales | s__Blautia_A intestinavium | 88.22 | 7.61 | 3.508119 |
| D300476:bin_000004 | p__Bacillota_A | o__Lachnospirales | s__ | 96.72 | 3.87 | 3.321694 |
| D300433:bin_000005 | p__Bacillota_A | o__Lachnospirales | s__Eisenbergiella intestinigallinarum | 98.06 | 5.28 | 4.869608 |
| D300513:bin_000002 | p__Bacillota_A | o__Lachnospirales | s__Choladocola avistercoris | 93.34 | 0.83 | 2.975524 |
| D300432:bin_000002 | p__Bacillota_A | o__Lachnospirales | s__Blautia ornithocaccae | 100.00 | 1.15 | 4.140997 |
| D300482:bin_000009 | p__Bacillota_A | o__Lachnospirales | s__Mediterraneibacter sp900761655 | 90.72 | 3.87 | 3.336211 |
| D300458:bin_000017 | p__Bacillota_A | o__Lachnospirales | s__Choladocola sp944381625 | 93.73 | 7.24 | 3.438612 |
| D300498:bin_000001 | p__Bacillota_A | o__Lachnospirales | s__Mediterraneibacter excrementipullorum | 99.94 | 1.80 | 2.749836 |
| D300428:bin_000005 | p__Bacillota_A | o__Lachnospirales | s__ | 93.51 | 4.99 | 3.342204 |
| D300467:bin_000021 | p__Bacillota_A | o__Lachnospirales | s__Merdisoma sp944375745 | 76.97 | 2.29 | 2.749947 |
| TG1_28:bin_000038 | p__Bacillota_A | o__Lachnospirales | s__Merdisoma sp002160825 | 74.33 | 4.93 | 2.585629 |
| D300440:bin_000012 | p__Bacillota_A | o__Lachnospirales | s__Mediterraneibacter intestinavium | 90.62 | 2.55 | 2.862982 |
| TG2_35:bin_000021 | p__Bacillota_A | o__Lachnospirales | s__Enterocloster excrementipullorum | 89.21 | 6.64 | 3.219621 |
| TG4_21:bin_000032 | p__Bacillota_A | o__Lachnospirales | s__Ruminococcus_G avistercoris | 80.23 | 3.41 | 2.623468 |
| D300457:bin_000005 | p__Bacillota_A | o__Lachnospirales | s__UMGS1370 sp904395885 | 89.15 | 2.24 | 3.399836 |
| D300423:bin_000007 | p__Bacillota_A | o__Lachnospirales | s__Mediterraneibacter faecavium | 93.57 | 4.45 | 3.316869 |
| TG3_28:bin_000042 | p__Bacillota_A | o__Lachnospirales | s__Mediterraneibacter faecipullorum | 91.64 | 1.60 | 2.678215 |
| D300525:bin_000012 | p__Bacillota_A | o__Lachnospirales | s__Merdisoma faecalis | 86.30 | 1.56 | 3.187551 |
| TG3_21:bin_000048 | p__Bacillota_A | o__Lachnospirales | s__Mediterraneibacter pullicola | 84.78 | 6.74 | 2.457129 |
| TG4:bin_000055 | p__Bacillota_A | o__Lachnospirales | s__ | 78.29 | 1.57 | 2.909419 |
| D300433:bin_000009 | p__Bacillota_A | o__Lachnospirales | s__Caccovicinus merdipullorum | 90.55 | 1.42 | 3.351914 |
| D300526:bin_000014 | p__Bacillota_A | o__Lachnospirales | s__Blautia stercorigallinarum | 86.29 | 2.63 | 3.288674 |
| TG3_07:bin_000023 | p__Bacillota_A | o__Lachnospirales | s__An181 sp002160325 | 82.37 | 4.16 | 2.711286 |
| D300512:bin_000015 | p__Bacillota_A | o__Lachnospirales | s__Mediterraneibacter avicola | 85.51 | 4.42 | 2.287612 |
| D300492:bin_000003 | p__Bacillota_A | o__Lachnospirales | s__Lachnoclostridium_A stercorigallinarum | 96.77 | 2.56 | 3.315623 |
| D300494:bin_000016 | p__Bacillota_A | o__Lachnospirales | s__Mediterraneibacter vanvlietii | 79.85 | 3.21 | 2.693835 |
| D300423:bin_000011 | p__Bacillota_A | o__Lachnospirales | s__Clostridium_Q saccharolyticum_A | 88.45 | 0.69 | 2.792279 |
| TG4_21:bin_000043 | p__Bacillota_A | o__Lachnospirales | s__Mediterraneibacter intestinigallinarum | 95.76 | 11.62 | 3.781974 |
| D300474:bin_000012 | p__Bacillota_A | o__Lachnospirales | s__Mediterraneibacter norwichensis | 92.57 | 1.46 | 2.990431 |
| D300522:bin_000007 | p__Bacillota_A | o__Lachnospirales | s__Mediterraneibacter faecigallinarum | 91.32 | 6.15 | 3.004011 |
| TG5_28:bin_000030 | p__Bacillota_A | o__Lachnospirales | s__Blautia_A avistercoris | 74.57 | 3.32 | 2.599135 |
| TG2_28:bin_000016 | p__Bacillota_A | o__Lachnospirales | s__ | 96.61 | 3.75 | 2.835823 |
| D300444:bin_000010 | p__Bacillota_A | o__Lachnospirales | s__Enterocloster excrementigallinarum | 91.11 | 2.04 | 3.198212 |
| TG3_28:bin_000041 | p__Bacillota_A | o__Lachnospirales | s__Merdimonas faecis | 76.37 | 1.02 | 2.636481 |
| TG2:bin_000059 | p__Bacillota_A | o__Lachnospirales | s__Pullilachnospira stercoravium | 77.48 | 7.08 | 3.204350 |
| D300499:bin_000015 | p__Bacillota_A | o__Lachnospirales | s__Caccovicinus sp017889125 | 95.70 | 5.45 | 4.069219 |
| TG1_35:bin_000022 | p__Bacillota_A | o__Lachnospirales | s__Copromonas faecavium | 91.11 | 5.18 | 2.944569 |
| TG3:bin_000048 | p__Bacillota_A | o__Lachnospirales | s__Sellimonas intestinalis | 87.71 | 1.25 | 2.676738 |
| TG5:bin_000047 | p__Bacillota_A | o__Lachnospirales | s__Mediterraneibacter sp944381495 | 82.17 | 4.83 | 3.168647 |
| TG1_21:bin_000035 | p__Bacillota_A | o__Lachnospirales | s__Lachnoclostridium_A sp002160755 | 82.21 | 12.80 | 3.502275 |
| D300517:bin_000003 | p__Bacillota_A | o__Lachnospirales | s__Caccomorpha excrementavium | 88.70 | 1.64 | 3.391694 |
| D300505:bin_000008 | p__Bacillota_A | o__Lachnospirales | s__Lachnoclostridium_A avicola | 87.18 | 4.63 | 2.891443 |
| TG3:bin_000050 | p__Bacillota_A | o__Lachnospirales | s__Hungatella_B pullicola | 95.67 | 2.50 | 3.051995 |
| D300418:bin_000017 | p__Bacillota_A | o__Lachnospirales | s__Lachnoclostridium_A stercoripullorum | 83.46 | 5.33 | 2.547828 |
| TG5:bin_000041 | p__Bacillota_A | o__Lachnospirales | s__Anaerobutyricum stercoris | 92.77 | 11.05 | 4.551054 |
| D300458:bin_000006 | p__Bacillota_A | o__Lachnospirales | s__Fimimorpha faecalis | 98.12 | 0.12 | 3.111616 |
| TG4_14:bin_000026 | p__Bacillota_A | o__Lachnospirales | s__Mediterraneibacter merdigallinarum | 75.53 | 4.31 | 3.426147 |
| TG1_21:bin_000022 | p__Bacillota_A | o__Lachnospirales | s__Anaerostipes butyraticus | 81.69 | 6.14 | 2.506645 |
| TG2_21:bin_000033 | p__Bacillota_A | o__Lachnospirales | s__Anaerostipes excrementavium | 72.89 | 3.94 | 2.273804 |
| TG3_35:bin_000008 | p__Bacillota_A | o__Christensenellales | s__Heteroclostridium caecigallinarum | 92.63 | 1.76 | 1.304384 |
| D300458:bin_000021 | p__Bacillota_A | o__Christensenellales | s__Borkfalkia sp944368775 | 54.80 | 1.19 | 1.081016 |
| TG5_21:bin_000004 | p__Bacillota_A | o__Christensenellales | s__Borkfalkia excrementigallinarum | 95.77 | 2.85 | 2.812137 |
| D300472:bin_000003 | p__Bacillota_A | o__Christensenellales | s__Borkfalkia sp904373255 | 91.75 | 1.35 | 2.791757 |
| TG2_28:bin_000003 | p__Bacillota_A | o__Christensenellales | s__Borkfalkia sp904374385 | 94.18 | 0.09 | 2.550675 |
| D300527:bin_000004 | p__Bacillota_A | o__Christensenellales | s__Borkfalkia sp944342025 | 88.01 | 1.01 | 2.650491 |
| D300429:bin_000001 | p__Bacillota_A | o__Christensenellales | s__Borkfalkia sp017886545 | 93.27 | 2.31 | 2.507500 |
| D300517:bin_000015 | p__Bacillota_A | o__Christensenellales | s__Borkfalkia faecigallinarum | 73.68 | 5.04 | 1.181874 |
| D300517:bin_000013 | p__Bacillota_A | o__Christensenellales | s__Gallimonas intestinigallinarum | 72.48 | 3.43 | 1.473980 |
| TG5:bin_000003 | p__Bacillota_A | o__Christensenellales | s__Scatosoma sp900555925 | 89.25 | 0.25 | 2.718994 |
| D300512:bin_000003 | p__Bacillota_A | o__Christensenellales | s__Gallimonas merdigallinarum | 92.91 | 1.09 | 2.227612 |
| D300474:bin_000002 | p__Bacillota_A | o__Christensenellales | s__Coproplasma avistercoris | 94.38 | 1.25 | 1.918856 |
| D300495:bin_000003 | p__Bacillota_A | o__Christensenellales | s__Coproplasma stercorigallinarum | 95.20 | 0.02 | 2.161095 |
| TG4_21:bin_000016 | p__Bacillota_A | o__Christensenellales | s__Coproplasma excrementigallinarum | 81.64 | 8.98 | 2.302376 |
| TG3:bin_000026 | p__Bacillota_A | o__Christensenellales | s__UMGS775 sp900545325 | 90.36 | 3.90 | 2.292378 |
| TG3_35:bin_000020 | p__Bacillota_A | o__Christensenellales | s__Spyradocola merdavium | 93.34 | 4.95 | 2.726737 |
| TG5_35:bin_000022 | p__Bacillota_A | o__Christensenellales | s__Pullichristensenella excrementipullorum | 83.77 | 5.79 | 2.156854 |
| TG4_21:bin_000040 | p__Bacillota_A | o__Christensenellales | s__Alectryocaccomicrobium faecavium | 50.56 | 1.23 | 2.589939 |
| TG5_14:bin_000008 | p__Bacillota_A | o__Clostridiales | s__Sarcina perfringens | 98.49 | 1.81 | 3.247971 |
| TG1:bin_000047 | p__Bacillota_A | o__Peptostreptococcales | s__Romboutsia sp904418825 | 79.76 | 2.84 | 1.955405 |
| TG1:bin_000065 | p__Bacillota_A | o__Eubacteriales | s__Eubacterium callanderi | 62.11 | 2.33 | 2.987929 |
| TG3_21:bin_000003 | p__Bacillota | o__CAJFEE01 | s__Harrysmithimonas galli | 100.00 | 0.34 | 2.986995 |
| TG2_21:bin_000011 | p__Bacillota | o__RF39 | s__CAG-302 sp017887885 | 94.26 | 0.44 | 1.428992 |
| D300517:bin_000004 | p__Bacillota | o__RF39 | s__Caccenecus sp900758895 | 90.97 | 1.92 | 1.461560 |
| TG4_35:bin_000014 | p__Bacillota | o__Erysipelotrichales | s__Massilimicrobiota sp002160865 | 90.16 | 4.32 | 2.312768 |
| D300509:bin_000001 | p__Bacillota | o__Erysipelotrichales | s__Massilimicrobiota merdigallinarum | 99.64 | 0.45 | 2.434131 |
| TG5_14:bin_000013 | p__Bacillota | o__Erysipelotrichales | s__Thomasclavelia ramosa | 87.40 | 6.68 | 3.698848 |
| TG5_21:bin_000003 | p__Bacillota | o__Erysipelotrichales | s__Thomasclavelia spiroformis | 100.00 | 0.58 | 2.497863 |
| TG2:bin_000056 | p__Bacillota | o__Erysipelotrichales | s__Fimiplasma intestinipullorum | 52.97 | 2.47 | 2.230129 |
| TG3:bin_000014 | p__Bacillota | o__Erysipelotrichales | s__Clostridium_AQ innocuum | 99.77 | 1.80 | 3.906678 |
| D300443:bin_000002 | p__Bacillota | o__Erysipelotrichales | s__Clostridium_AQ sp900552125 | 100.00 | 1.11 | 2.697713 |
| TG3:bin_000008 | p__Bacillota | o__Erysipelotrichales | s__ | 99.77 | 4.95 | 2.421094 |
| TG1_21:bin_000012 | p__Bacillota | o__Erysipelotrichales | s__Merdibacter merdigallinarum | 96.86 | 3.07 | 2.084500 |
| TG3:bin_000006 | p__Bacillota | o__ML615J-28 | s__CAG-313 sp000433035 | 96.14 | 1.25 | 1.680109 |
| TG1:bin_000046 | p__Bacillota | o__Haloplasmatales | s__Turicibacter sp017888305 | 73.62 | 3.05 | 1.915101 |
| TG5_35:bin_000001 | p__Bacillota | o__Lactobacillales | s__Streptococcus alactolyticus | 99.99 | 0.09 | 1.577486 |
| TG3:bin_000079 | p__Bacillota | o__Lactobacillales | s__Enterococcus_D gallinarum | 56.56 | 2.07 | 1.698850 |
| TG3_14:bin_000007 | p__Bacillota | o__Lactobacillales | s__Enterococcus_B hirae | 99.96 | 3.12 | 2.864690 |
| D300492:bin_000001 | p__Bacillota | o__Lactobacillales | s__Enterococcus faecalis | 100.00 | 1.31 | 2.778167 |
| TG2:bin_000054 | p__Bacillota | o__Lactobacillales | s__Enterococcus_A avium | 57.11 | 3.91 | 2.582418 |
| D300479:bin_000001 | p__Bacillota | o__Lactobacillales | s__Lactobacillus crispatus | 99.96 | 0.53 | 1.942229 |
| TG5_28:bin_000004 | p__Bacillota | o__Lactobacillales | s__Lactobacillus johnsonii | 99.95 | 0.50 | 1.793304 |
| TG2:bin_000055 | p__Bacillota | o__Lactobacillales | s__Lactobacillus gallinarum | 75.14 | 0.37 | 1.419434 |
| TG2_21:bin_000003 | p__Bacillota | o__Lactobacillales | s__Limosilactobacillus reuteri_E | 97.92 | 3.06 | 2.012861 |
| TG1:bin_000020 | p__Bacillota | o__Lactobacillales | s__Limosilactobacillus fermentum | 90.31 | 2.27 | 1.824892 |
| TG5_14:bin_000004 | p__Bacillota | o__Lactobacillales | s__Ligilactobacillus salivarius | 99.83 | 0.42 | 2.112246 |
#Generate quality biplot
genome_biplot <- genome_metadata %>%
select(c(genome,domain,phylum,completeness,contamination,length)) %>%
arrange(match(genome, rev(genome_tree$tip.label))) %>% #sort MAGs according to phylogenetic tree
ggplot(aes(x=completeness,y=contamination,size=length,color=phylum)) +
geom_point(alpha=0.7) +
ylim(c(10,0)) +
scale_color_manual(values=phylum_colors) +
labs(y= "Contamination", x = "Completeness") +
theme_classic() +
theme(legend.position = "none")
#Generate contamination boxplot
genome_contamination <- genome_metadata %>%
ggplot(aes(y=contamination)) +
ylim(c(10,0)) +
geom_boxplot(colour = "#999999", fill="#cccccc") +
theme_void() +
theme(legend.position = "none",
axis.title.x = element_blank(),
axis.title.y = element_blank(),
axis.text.y=element_blank(),
axis.ticks.y=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.margin = unit(c(0, 0, 0.40, 0),"inches")) #add bottom-margin (top, right, bottom, left)
#Generate completeness boxplot
genome_completeness <- genome_metadata %>%
ggplot(aes(x=completeness)) +
xlim(c(50,100)) +
geom_boxplot(colour = "#999999", fill="#cccccc") +
theme_void() +
theme(legend.position = "none",
axis.title.x = element_blank(),
axis.title.y = element_blank(),
axis.text.y=element_blank(),
axis.ticks.y=element_blank(),
axis.text.x=element_blank(),
axis.ticks.x=element_blank(),
plot.margin = unit(c(0, 0, 0, 0.50),"inches")) #add left-margin (top, right, bottom, left)
#Render composite figure
grid.arrange(grobs = list(genome_completeness,genome_biplot,genome_contamination),
layout_matrix = rbind(c(1,1,1,1,1,1,1,1,1,1,1,4),
c(2,2,2,2,2,2,2,2,2,2,2,3),
c(2,2,2,2,2,2,2,2,2,2,2,3),
c(2,2,2,2,2,2,2,2,2,2,2,3),
c(2,2,2,2,2,2,2,2,2,2,2,3),
c(2,2,2,2,2,2,2,2,2,2,2,3),
c(2,2,2,2,2,2,2,2,2,2,2,3),
c(2,2,2,2,2,2,2,2,2,2,2,3),
c(2,2,2,2,2,2,2,2,2,2,2,3),
c(2,2,2,2,2,2,2,2,2,2,2,3),
c(2,2,2,2,2,2,2,2,2,2,2,3),
c(2,2,2,2,2,2,2,2,2,2,2,3)))
# Aggregate basal GIFT into elements
function_table <- genome_gifts %>%
to.elements(., GIFT_db)
# Generate basal tree
function_tree <- force.ultrametric(genome_tree, method="extend") %>%
ggtree(., size = 0.3)
## ***************************************************************
## * Note: *
## * force.ultrametric does not include a formal method to *
## * ultrametricize a tree & should only be used to coerce *
## * a phylogeny that fails is.ultrametric due to rounding -- *
## * not as a substitute for formal rate-smoothing methods. *
## ***************************************************************
#Add phylum colors next to the tree tips
function_tree <- gheatmap(function_tree, phylum_heatmap, offset=0, width=0.1, colnames=FALSE) +
scale_fill_manual(values=phylum_colors) +
labs(fill="Phylum")
#Reset fill scale to use a different colour profile in the heatmap
function_tree <- function_tree + new_scale_fill()
#Add functions heatmap
function_tree <- gheatmap(function_tree, function_table, offset=0.5, width=3.5, colnames=FALSE) +
vexpand(.08) +
coord_cartesian(clip = "off") +
scale_fill_gradient(low = "#f4f4f4", high = "steelblue", na.value="white") +
labs(fill="Function fullness")
#Reset fill scale to use a different colour profile in the heatmap
function_tree <- function_tree + new_scale_fill()
# Add completeness barplots
function_tree <- function_tree +
geom_fruit(data=genome_metadata,
geom=geom_bar,
grid.params=list(axis="x", text.size=2, nbreak = 1),
axis.params=list(vline=TRUE),
mapping = aes(x=length, y=genome, fill=completeness),
offset = 3.8,
orientation="y",
stat="identity") +
scale_fill_gradient(low = "#cf8888", high = "#a2cc87") +
labs(fill="Genome completeness")
function_tree
## Functional ordination
# Generate the tSNE ordination
tSNE_function <- Rtsne(X=function_table, dims = 2, check_duplicates = FALSE)
# Plot the ordination
function_ordination <- tSNE_function$Y %>%
as.data.frame() %>%
mutate(genome=rownames(function_table)) %>%
inner_join(genome_metadata, by="genome") %>%
rename(tSNE1="V1", tSNE2="V2") %>%
select(genome,phylum,tSNE1,tSNE2, length) %>%
ggplot(aes(x = tSNE1, y = tSNE2, color = phylum, size=length))+
geom_point(shape=16, alpha=0.7) +
scale_color_manual(values=phylum_colors) +
theme_minimal() +
labs(color="Phylum", size="Genome size") +
guides(color = guide_legend(override.aes = list(size = 5))) # enlarge Phylum dots in legend
function_ordination